The present invention relates generally to searching for computer files and more particularly to an apparatus and method for increasing search efficiency and accuracy by maintaining records of a last-known location for one or more files.
As computer programs (application programs) become more and more sophisticated, they are typically implemented with a host of component files (component files) for performing certain functions or providing particular data. It is often critical that these component files are accessible to the application program in order for the application program to be executed in an efficient manner. Unfortunately, computer users have grown accustomed to moving the component files from their original location to other locations within their computer""s file system. Usually a computer""s operating system will organize files in the file system by maintaining the files within a directory tree structure. If a file is moved independently of the application program, the application program may be unable to locate a component file when the component file is needed. A failure to locate the component file can result in inefficient operation, failure of a particular function, or even a failure to continue execution of the application program.
A first attempt at maintaining the location of component files involved the maintenance of a preferences file associated with a particular application program. The preferences file was used to store the location of each component file. When the application program sought to access the component file, then it could reference the preferences file to determine the location of the particular component file. Thus, if component files were moved, the application program could still determine the new location, as long as the preferences file was properly updated. Unfortunately, users commonly moved component files without updating the preferences file. The only available means of correcting the preferences file was to re-install the application program.
A second attempt at maintaining the location of component files involved the creation and maintenance of a Registry. The Registry could be implemented as a single file for an entire operating system and/or a single application program. The Registry could be automatically updated when the operating system recognized that a registered component file was moved to a different location. The problems associated with the Registry were that it was slow and fragile. If the Registry was damaged, all file location information could be lost. Similarly, the file location information in the Registry was not isolated. Thus, a change to the Registry made by one application program could adversely affect the ability of a second application program to maintain component file locations in the same Registry. If the Registry was unable to provide an application program with the needed file locations, then the application program would have to be re-installed to correct the Registry.
A reliable means for locating component files has become even more desirable in light of a current trend in application program installation requirements. In order to avoid complications associated with the installation of application programs, software developers have reduced installation requirements to the simple act of copying files from one disk to another (xe2x80x9cdrag-and-dropxe2x80x9d). A user can now purchase a disk containing an application program and install the application program by simply copying files to the user""s hard drive. The application program is then fully executable from the user""s hard drive without further installation steps. Because no installation program is used, there is no way to correct a preferences file or the Registry.
Therefore, there is a need for a file maintenance system capable of enabling a drag-and-drop installation procedure while providing accurate, readily updateable, and easily accessible component file locations for the application program. The file maintenance system should also perform these functions in a time and memory conserving manner.
The present invention solves the problem of conventional component file locators by providing a searching function and a location caching function. The present invention receives a file location request from a program module and responds with a file location identifying the location of one or more component files within a directory tree structure. The file location request contains search criteria that ideally identifies at least one component file. The search request might contain search criteria having the identifying characteristics of one or more files available within the folder tree.
If the file location of the sought component file is unchanged since the component file was last accessed, then the last known file location will be returned to the requesting program module. If the file location of the component file has changed or has never been searched, then an attempt will be made to locate the component file the new file location will be returned to the program module. All file locations are stored in a file location cache so that subsequent searches can be minimized.
The file location cache can be characterized as a four-column table. In the first column is a list of each different set of search criteria that has been received as a portion of a file location request. Every time a file location request containing a new set of search criteria is received, the new set of search criteria is added to the first column of the cache and a new search record is created. The date and time of the last search criteria match is stored in the cache, regardless of whether the search criteria existed before the last search.
The second column contains a list of file locations. Each file location identifies the folder tree location of one or more component files satisfying the search criteria in the corresponding first column entry. The file location indicates the last known location of the file(s) satisfying the search criteria.
A third column of the file location cache may also be used to store xe2x80x9cextraxe2x80x9d search criteria. Extra search criteria is search criteria that is characteristic of a particular application program and/or component file. Generally, search criteria is defined by the operating system and includes such identifying characteristics as: file name, size, file type, label, date modified/created, version, comments, creator, etc. Extra search criteria may include other characteristics, such as the sought component file""s capabilities. Extra search criteria can be used to speed subsequent searches by eliminating from consideration files that satisfy the general search criteria, but do not satisfy the extra search criteria.
A fourth column can be used to store xe2x80x9ctagsxe2x80x9d, which permit a program module to mark the component files listed in the file location cache. This marking permits the program module to narrow its search when performing subsequent searches for the marked component file.
When a file location request is received, the search criteria contained therein is identified. The search criteria is then compared to the first column of the cache to determine whether a search has been previously performed for the file location request. If the particular search has never been performed, then the entire folder tree structure (or some predefined portion thereof) will have to be searched for the requested file location.
If the search criteria does exist in the cache, then the corresponding file location in the second column is examined. A determination is made as to whether the file location is valid. The validity of the file location depends on whether the folder in which the file location resides has been modified since the last search. If the folder has been modified, then a new search is performed for the requested file location. If the folder has not been modified, then the stored file location is returned to the requesting program module.
When either the search criteria does not exist or the folder in question has been modified, the requested file location is searched for in a manner that is well known to those skilled in the computer arts. In the event that the search criteria does not exist in the cache or that the folder has been modified, then the file location cache must be updated following the subsequent search.
If the search criteria is new, then a new first column entry is created in the file location cache. The file locations that are determined by searching the directory tree structure are stored in a corresponding new second column (file locations) entry.
If a modified folder is the reason for the new search, then the second column entry corresponding to the search criteria is modified to reflect the results of the new search. This procedure effectively updates the cache, so that unnecessary, subsequent searches need not be performed.